package cn.it62.pojo;

/**
 * @author zhenhuaShen
 * @version 1.0
 * @date 2019/7/30
 * @description cn.it62.pojo
 */
public class Penguin extends Pet {
    private String color;

    public String getColor(){
        return color;
    }

    public void setColor(String color){
        this.color = color;
    }

    @Override
    public  String toString(){
        return "Penguin{"+
                "nickName='" + getNickName() + '\''+
                ", gender='" + getGender() + '\'' +
                ", love='" + getLove() + '\'' +
                ", age=" + getAge() +
                ", health=" + getHealth() +
                ", color=" + getColor()+
                '}';
    }

    /**
     * 吃食物
     *
     * @param food
     */
    @Override
    public void eat(String food) {
        System.out.println("名字叫" + getNickName() + "的企鹅在吃" + food);
        if (getHealth() < 100) {
            int health = getHealth();
            health++;
            setHealth(health);
        }
    }



    /**
     * 玩耍
     */
    @Override
    public void play() {
        if (getHealth() > 1) {
            System.out.println("名字叫" + getNickName() + "的企鹅在玩耍");
            int health = getHealth();
            health--;
            setHealth(health);
            if (getLove() < 100) {
                int love = getLove();
                love++;
                setLove(love);

            }
        } else {
            System.out.println("狗狗没力气了，需要休息补充食物！");
        }
    }
}






